#ifndef RESOURCEMANAGER_H
#define RESOURCEMANAGER_H

#include "Framework/Prerequisites.h"
#include "IO/Resource.h"
#include "IO/ResourceGroupManager.h"

namespace tyro
{
	namespace IO
	{
		class ResourceManager
		{
		public:

			ResourceManager();

			// Resource map by name
			typedef ::stdext::hash_map<String, ResourcePtr> ResourceMap;
			// Resource Maps by group
			typedef ::stdext::hash_map<String, ResourceMap> ResourceGroupMap;
			// Resource create or load result type
			typedef std::pair<ResourcePtr, bool> ResourceCreateOrLoadResult;

			virtual ResourcePtr Load( const String& name, const String& groupName);
			virtual ResourceCreateOrLoadResult CreateOrLoad( const String& name, const String& groupName);
			virtual ResourcePtr GetResourceByName( const String& name, const String& groupName = ResourceGroupManager::DEFAULT_GROUP_NAME );
			virtual ResourcePtr Create( const String& name, const String& group );
			void AddResource( ResourcePtr res );
			ResourceHandle GetNextHandle( void );
			virtual Resource* CreateImpl( const String& name, ResourceHandle resHandle, const String& group ) = 0;

		protected:
			
			ResourceMap resources;
			ResourceHandle resourceHandleCount;
			String resourceType;

		private:
		};
	}
}
#endif